package com.solcoo.controller;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.solcoo.dao.MerchantTypeDao;
import com.solcoo.pojo.MerchantType;

@Controller
public class MerchantTypeController extends AbstractController {

	@Resource
	private MerchantTypeDao merchantTypeDao;
	
    @RequestMapping(value="listMerchantType.do")
    public @ResponseBody JsonResult2 listMerchantType() throws Exception {
		List<MerchantType> mts = merchantTypeDao.getList();
		return this.getSuccessJsonResult2(mts);
    }
    

//    @RequestMapping(value="addMerchantType.do")
//    public @ResponseBody JsonResult2 addMerchantType(Integer pid, String typeName) {
//    	try {
//    		MerchantType mt = new MerchantType();
//    		mt.setPid(pid);
//    		mt.setTypeName(typeName);
//			boolean b = merchantTypeDao.add(mt);
//			if(!b) {
//				return this.getFailJsonResult2("新增失败");
//			}
//			List<MerchantType> mts = merchantTypeDao.getList();
//			return this.getSuccessJsonResult2(mts);
//		} catch (Exception e) {
//			logger.error(e.getMessage(),e);
//            return this.getFailJsonResult2("系统异常，请重试");
//		}
//    }
}